/**
 * com.cnhis.his.customer.service.Bce1Service.java
 */
package com.mbmed.doctor.login.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Request;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.mbmed.doctor.commons.mapper.ModelVo;
import com.mbmed.doctor.login.bo.Bce1Bo;
import com.mbmed.doctor.login.mapper.Bce1;

/**
 * @file  Bce1Service.java
 * @author 刘武
 * @version 0.1
 * @todo	Bce1服务操作接口
 * Copyright(C), 2013-2014
 *		 Shenzhen Coordinates Software Development Co., Ltd.
 * History
 *   	1. Date: 2014-09-28 01:39:11
 *      	Author: 刘武
 *      	Modification: this file was created
 *   	2. ...
 */
@Path("/bce1")
@Component
public class Bce1Service {
	
	private static Logger logger = Logger.getLogger(Bce1.class);
	
	@Autowired
	private Bce1Bo bce1Bo;
	
	@Context
	Request request;

	
	/**
	 * 查找所有数据库记录
     * @return type : List 返回查询操作所有符合条件的记录的VO对象集合，操作失败返回null
     */
	@GET
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
    public List<Bce1> getAll() throws Exception{
        List<Bce1> list = new ArrayList<Bce1>();
        return bce1Bo.getAll();        
    }
	
	
	/**
     * 查询主刀医生
     * @param id 与数据库中主键对应的值
     * @return type :  返回查询操作所有符合条件的记录的VO对象，操作失败返回null
     * @throws Exception
     */
	@GET
	@Path("/getadivoperatedoctor")
	@Produces({MediaType.APPLICATION_JSON})
    public ModelVo getAdivOperateDoctor(
    		@QueryParam("bcetxt") java.lang.String bcetxt,
    		@QueryParam("ltype") java.lang.String ltype,
    		@QueryParam("bck01") java.lang.String bck01
    		) throws Exception{
		ModelVo modelvo = new ModelVo();
		Map<String,Object> paramap = new HashMap<String,Object>();
		int ltypet = Integer.parseInt(ltype);
		int lbck01 = Integer.parseInt(bck01);
		paramap.put("bcetxt", bcetxt);
		paramap.put("ltypet", ltypet);
		paramap.put("bck01", lbck01);
		
		List<Bce1>  list = new ArrayList<Bce1>();
	    list = bce1Bo.getAdivOperateDoctor(paramap);
		modelvo.setList(list);
    	return modelvo;
	}
	
	/**
     * 查询门(急)诊医生
     * @param id 与数据库中主键对应的值
     * @return type :  返回查询操作所有符合条件的记录的VO对象，操作失败返回null
     * @throws Exception
     */
	@GET
	@Path("/getmenjizhendoctor")
	@Produces({MediaType.APPLICATION_JSON})
    public ModelVo getMenJiZhenDoctor(
    		@QueryParam("txt") java.lang.String txt
    		) throws Exception{
		ModelVo modelvo = new ModelVo();
		Map<String,Object> paramap = new HashMap<String,Object>();
		paramap.put("txt", txt);
		List<Bce1>  list = new ArrayList<Bce1>();
	    list = bce1Bo.getMenJiZhenDoctor(paramap);
		modelvo.setList(list);
    	return modelvo;
	}
	
	
	/**
     * 查询责任护士
     * @param id 与数据库中主键对应的值
     * @return type :  返回查询操作所有符合条件的记录的VO对象，操作失败返回null
     * @throws Exception
     */
	@GET
	@Path("/getzerennurse")
	@Produces({MediaType.APPLICATION_JSON})
    public ModelVo getZeRenNurse(
    		@QueryParam("txt") java.lang.String txt
    		) throws Exception{
		ModelVo modelvo = new ModelVo();
		Map<String,Object> paramap = new HashMap<String,Object>();
		paramap.put("txt", txt);
		List<Bce1>  list = new ArrayList<Bce1>();
	    list = bce1Bo.getZeRenNurse(paramap);
		modelvo.setList(list);
    	return modelvo;
	}
	
	
	
	
	
    /**
     * 查找符合条件的所有数据库记录
     * @param id 与数据库中主键对应的值
     * @return type :  返回查询操作所有符合条件的记录的VO对象，操作失败返回null
     * @throws Exception
     */
	@GET
	@Path("{id}")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
    public Bce1 getBce1(@PathParam("id") String id) throws Exception{
    	Bce1 bce1 = null;
    	return bce1Bo.get(id);        
    }
    /**
     * 向数据库中插入一条记录
     * @param vo 与数据库中记录对应的值对象
     * @return type : 返回插入操作是否成功
     * @throws Exception
     */
	@POST
	@Produces(MediaType.APPLICATION_JSON)
	@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
	public Bce1 saveBce1(
			@FormParam("bce01") java.lang.Integer bce01,
			@FormParam("bce02") java.lang.String bce02,
			@FormParam("bce03") java.lang.String bce03,
			@FormParam("bce04") java.lang.String bce04,
			@FormParam("bce05") java.lang.String bce05,
			@FormParam("bce06") java.lang.String bce06,
			@FormParam("abbrp") java.lang.String abbrp,
			@FormParam("abbrw") java.lang.String abbrw,
			@FormParam("abw01") java.lang.String abw01,
			@FormParam("ack01") java.lang.String ack01,
			@FormParam("bce11") java.lang.String bce11,
			@FormParam("abq01") java.lang.String abq01,
			@FormParam("bce13") java.util.Date bce13,
			@FormParam("bck01") java.lang.Integer bck01,
			@FormParam("acp01") java.lang.String acp01,
			@FormParam("aay01") java.lang.String aay01,
			@FormParam("act01") java.lang.String act01,
			@FormParam("bce18") java.lang.String bce18,
			@FormParam("bce19") java.util.Date bce19,
			@FormParam("abu02") java.lang.String abu02,
			@FormParam("aad01") java.lang.String aad01,
			@FormParam("abg01") java.lang.String abg01,
			@FormParam("bce23") java.lang.String bce23,
			@FormParam("bce24") java.lang.String bce24,
			@FormParam("abs01") java.lang.String abs01,
			@FormParam("abi01") java.lang.String abi01,
			@FormParam("aah01") java.lang.String aah01,
			@FormParam("bce28") java.util.Date bce28,
			@FormParam("aaq01") java.lang.String aaq01,
			@FormParam("abe01") java.lang.String abe01,
			@FormParam("bce31") java.util.Date bce31,
			@FormParam("bce32") java.util.Date bce32,
			@FormParam("bce33") java.lang.String bce33,
			@FormParam("bce34") java.lang.String bce34,
			@FormParam("bce35") java.lang.String bce35,
			@FormParam("bce36") java.lang.String bce36,
			@FormParam("bce37") java.lang.String bce37,
			@FormParam("bce38") java.lang.String bce38,
			@FormParam("bce39") java.lang.String bce39,
			@FormParam("bce40") java.lang.Integer bce40,
			@FormParam("bce41") java.lang.Short bce41,
			@FormParam("bce42") java.lang.String bce42,
			@FormParam("bce43") java.lang.String bce43,
			@Context HttpServletResponse servletResponse
	) throws Exception {
		Bce1 bce1 = new Bce1();
		bce1.setBce01(bce01);
		bce1.setBce02(bce02);
		bce1.setBce03(bce03);
		bce1.setBce04(bce04);
		bce1.setBce05(bce05);
		bce1.setBce06(bce06);
		bce1.setAbbrp(abbrp);
		bce1.setAbbrw(abbrw);
		bce1.setAbw01(abw01);
		bce1.setAck01(ack01);
		bce1.setBce11(bce11);
		bce1.setAbq01(abq01);
		bce1.setBce13(bce13);
		bce1.setBck01(bck01);
		bce1.setAcp01(acp01);
		bce1.setAay01(aay01);
		bce1.setAct01(act01);
		bce1.setBce18(bce18);
		bce1.setBce19(bce19);
		bce1.setAbu02(abu02);
		bce1.setAad01(aad01);
		bce1.setAbg01(abg01);
		bce1.setBce23(bce23);
		bce1.setBce24(bce24);
		bce1.setAbs01(abs01);
		bce1.setAbi01(abi01);
		bce1.setAah01(aah01);
		bce1.setBce28(bce28);
		bce1.setAaq01(aaq01);
		bce1.setAbe01(abe01);
		bce1.setBce31(bce31);
		bce1.setBce32(bce32);
		bce1.setBce33(bce33);
		bce1.setBce34(bce34);
		bce1.setBce35(bce35);
		bce1.setBce36(bce36);
		bce1.setBce37(bce37);
		bce1.setBce38(bce38);
		bce1.setBce39(bce39);
		bce1.setBce40(bce40);
		bce1.setBce41(bce41);
		bce1.setBce42(bce42);
		bce1.setBce43(bce43);

		return bce1 = bce1Bo.save(bce1);

	}
	/**
     * 删除数据库中与传入的值对象对应的记录
     * @param vo 与数据库中记录对应的值对象
     * @return type : boolean 返回删除操作是否成功
     * @throws Exception
     */
	@DELETE
	@Path("{id}")
	public boolean removeBce1(@PathParam("id") String id) throws Exception{
		if(id == null) return false;
    	return bce1Bo.remove(id);

	}
	
}
